home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Aliases.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  6.1 KB  |  192 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Aliases.h
  3.  
  4.      Contains:    Alias Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1989-1997, 1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __ALIASES__
  19. #define __ALIASES__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __APPLETALK__
  25. #include <AppleTalk.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53.  
  54. enum {
  55.     rAliasType                    = FOUR_CHAR_CODE('alis')        /* Aliases are stored as resources of this type */
  56. };
  57.  
  58.  
  59. enum {
  60.                                                                 /* define alias resolution action rules mask */
  61.     kARMMountVol                = 0x00000001,                    /* mount the volume automatically */
  62.     kARMNoUI                    = 0x00000002,                    /* no user interface allowed during resolution */
  63.     kARMMultVols                = 0x00000008,                    /* search on multiple volumes */
  64.     kARMSearch                    = 0x00000100,                    /* search quickly */
  65.     kARMSearchMore                = 0x00000200,                    /* search further */
  66.     kARMSearchRelFirst            = 0x00000400                    /* search target on a relative path first */
  67. };
  68.  
  69.  
  70. enum {
  71.                                                                 /* define alias record information types */
  72.     asiZoneName                    = -3,                            /* get zone name */
  73.     asiServerName                = -2,                            /* get server name */
  74.     asiVolumeName                = -1,                            /* get volume name */
  75.     asiAliasName                = 0,                            /* get aliased file/folder/volume name */
  76.     asiParentName                = 1                                /* get parent folder name */
  77. };
  78.  
  79. /* define the alias record that will be the blackbox for the caller */
  80. struct AliasRecord {
  81.     OSType                             userType;                    /* appl stored type like creator type */
  82.     unsigned short                     aliasSize;                    /* alias record size in bytes, for appl usage */
  83. };
  84. typedef struct AliasRecord AliasRecord;
  85.  
  86. typedef AliasRecord *                    AliasPtr;
  87. typedef AliasPtr *                        AliasHandle;
  88. /* alias record information type */
  89. typedef short                             AliasInfoType;
  90. /*  create a new alias between fromFile-target and return alias record handle  */
  91. EXTERN_API( OSErr )
  92. NewAlias                        (ConstFSSpecPtr         fromFile,
  93.                                  const FSSpec *            target,
  94.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7002, 0xA823);
  95.  
  96. /* create a minimal new alias for a target and return alias record handle */
  97. EXTERN_API( OSErr )
  98. NewAliasMinimal                    (const FSSpec *            target,
  99.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7008, 0xA823);
  100.  
  101. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  102. EXTERN_API( OSErr )
  103. NewAliasMinimalFromFullPath        (short                     fullPathLength,
  104.                                  const void *            fullPath,
  105.                                  ConstStr32Param         zoneName,
  106.                                  ConstStr31Param         serverName,
  107.                                  AliasHandle *            alias)                                TWOWORDINLINE(0x7009, 0xA823);
  108.  
  109. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  110. EXTERN_API( OSErr )
  111. ResolveAlias                    (ConstFSSpecPtr         fromFile,
  112.                                  AliasHandle             alias,
  113.                                  FSSpec *                target,
  114.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7003, 0xA823);
  115.  
  116. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  117. EXTERN_API( OSErr )
  118. GetAliasInfo                    (AliasHandle             alias,
  119.                                  AliasInfoType             index,
  120.                                  Str63                     theString)                            TWOWORDINLINE(0x7007, 0xA823);
  121.  
  122. /* 
  123.   Given a file spec, return target file spec if input file spec is an alias.
  124.   It resolves the entire alias chain or one step of the chain.  It returns
  125.   info about whether the target is a folder or file; and whether the input
  126.   file spec was an alias or not. 
  127. */
  128. EXTERN_API( OSErr )
  129. ResolveAliasFile                (FSSpec *                theSpec,
  130.                                  Boolean                 resolveAliasChains,
  131.                                  Boolean *                targetIsFolder,
  132.                                  Boolean *                wasAliased)                            TWOWORDINLINE(0x700C, 0xA823);
  133.  
  134. EXTERN_API( OSErr )
  135. FollowFinderAlias                (ConstFSSpecPtr         fromFile,
  136.                                  AliasHandle             alias,
  137.                                  Boolean                 logon,
  138.                                  FSSpec *                target,
  139.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x700F, 0xA823);
  140.  
  141. /* 
  142.    Low Level Routines 
  143. */
  144. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  145. EXTERN_API( OSErr )
  146. UpdateAlias                        (ConstFSSpecPtr         fromFile,
  147.                                  const FSSpec *            target,
  148.                                  AliasHandle             alias,
  149.                                  Boolean *                wasChanged)                            TWOWORDINLINE(0x7006, 0xA823);
  150.  
  151.  
  152. typedef CALLBACK_API( Boolean , AliasFilterProcPtr )(CInfoPBPtr cpbPtr, Boolean *quitFlag, Ptr myDataPtr);
  153. typedef STACK_UPP_TYPE(AliasFilterProcPtr)                         AliasFilterUPP;
  154. enum { uppAliasFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  155. #define NewAliasFilterProc(userRoutine)                         (AliasFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAliasFilterProcInfo, GetCurrentArchitecture())
  156. #define CallAliasFilterProc(userRoutine, cpbPtr, quitFlag, myDataPtr)  CALL_THREE_PARAMETER_UPP((userRoutine), uppAliasFilterProcInfo, (cpbPtr), (quitFlag), (myDataPtr))
  157.  
  158. /*  Given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag */
  159. EXTERN_API( OSErr )
  160. MatchAlias                        (ConstFSSpecPtr         fromFile,
  161.                                  unsigned long             rulesMask,
  162.                                  AliasHandle             alias,
  163.                                  short *                aliasCount,
  164.                                  FSSpecArrayPtr         aliasList,
  165.                                  Boolean *                needsUpdate,
  166.                                  AliasFilterUPP         aliasFilter,
  167.                                  void *                    yourDataPtr)                        TWOWORDINLINE(0x7005, 0xA823);
  168.  
  169.  
  170.  
  171.  
  172. #if PRAGMA_STRUCT_ALIGN
  173.     #pragma options align=reset
  174. #elif PRAGMA_STRUCT_PACKPUSH
  175.     #pragma pack(pop)
  176. #elif PRAGMA_STRUCT_PACK
  177.     #pragma pack()
  178. #endif
  179.  
  180. #ifdef PRAGMA_IMPORT_OFF
  181. #pragma import off
  182. #elif PRAGMA_IMPORT
  183. #pragma import reset
  184. #endif
  185.  
  186. #ifdef __cplusplus
  187. }
  188. #endif
  189.  
  190. #endif /* __ALIASES__ */
  191.  
  192.